/**
 *
 */
package com.ebocy.hammer.battle;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.ebocy.hammer.core.constants.GameConstants;

/**
 * @author Qingrong Hou
 * 
 *         May 16, 2012
 */
public class BattleCache {
	private static BattleCache battleCache = new BattleCache();

	private BattleCache() {
	}

	public static BattleCache getInstance() {
		return battleCache;
	}

	private static Map<Integer, Long> gameStartTimer = new ConcurrentHashMap<Integer, Long>();
	private static Map<Integer, Long> gameEndTimer = new ConcurrentHashMap<Integer, Long>();
	private static Map<Integer, Long> readyRoom = new ConcurrentHashMap<Integer, Long>();

	public static Map<Integer, Long> getGameStartTimer() {
		return gameStartTimer;
	}

	public static Map<Integer, Long> getGameEndTimer() {
		return gameEndTimer;
	}

	public static Map<Integer, Long> getReadyRoom() {
		return readyRoom;
	}

	public static void recordCombatTimestamp(int roomId) {
		long currentTimeMillis = System.currentTimeMillis();
		gameStartTimer.put(roomId, currentTimeMillis + GameConstants.COMBAT_PREPARE_TIME_SECOND * 1000);
		gameEndTimer.put(roomId, currentTimeMillis + GameConstants.COMBAT_ROUND_TIME_MINUTE * 60 * 1000);
	}

}
